import type {
  emailLoginForm,
  getKeyRes,
  getQRcodeParams,
  getQRcodeRes,
  loginFormTypes,
  phoneLoginApiData,
  sendCodeApiParams,
  sendCodeRes,
} from "@/types/login";
import request from "@/utils/request";
export const visitorLogin = () => {
  return request({
    method: "post",
    url: "/register/anonimous",
  });
};
export const getQRkey = () => {
  return request<getKeyRes>({
    method: "get",
    url: "/login/qr/key",
  });
};
export const getQRcode = (params: getQRcodeParams) => {
  return request<getQRcodeRes>({
    method: "get",
    url: "/login/qr/create",
    params,
  });
};
export const phoneLoginApi = (data: phoneLoginApiData) => {
  return request({
    method: "post",
    url: "/login/cellphone",
    data,
  });
};
export const sendCodeApi = (params: sendCodeApiParams) => {
  return request<sendCodeRes>({
    method: "get",
    url: "/captcha/sent",
    params,
  });
};
export const emailLoginApi = (data: emailLoginForm) => {
  return request({
    method: "post",
    url: "/login",
    data,
  });
};
